<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>APP</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
</head>
<body>
	<div class="aui-searchbar-wrap demo" id="search">
        <div class="aui-searchbar aui-border-radius" tapmode onclick="doSearch()">
            <i class="aui-iconfont aui-icon-search"></i>
            <div class="aui-searchbar-text">请输入搜索内容</div>
            <div class="aui-searchbar-input">
            	<input type="text" placeholder="请输入搜索内容" autocapitalize="off">
            </div>
        </div>
        <div class="aui-searchbar-cancel aui-text-info" tapmode onclick="cancelSearch()">取消</div>
    </div>
</body>
<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript">
	apiready = function(){
		api.parseTapmode();
		// $api.addEvt($api.dom(".aui-searchbar"), 'click', function(){
		// 	$api.addCls($api.dom(".aui-searchbar-wrap"),"focus");
		// 	$api.dom('.aui-searchbar-input input').focus();
		// });
		// $api.addEvt($api.dom(".aui-searchbar-cancel"), 'click', function(){
		// 	if($api.dom(".aui-searchbar-wrap.focus")){
		// 		$api.removeCls($api.dom(".aui-searchbar-wrap.focus"),"focus");
		// 	}
			
		// });
	}
	function doSearch(){
		$api.addCls($api.dom(".aui-searchbar-wrap"),"focus");
		$api.dom('.aui-searchbar-input input').focus();
	}
	function cancelSearch(){
		$api.addEvt($api.dom(".aui-searchbar-cancel"), 'click', function(){
			$api.removeCls($api.dom(".aui-searchbar-wrap.focus"),"focus");
		});
	}
</script>
</html>